-include ~/.Makefile # Architechture dependent stuff

MAKEDEP = /home/mjarvis/bin/makedepf90

F90C = ifort
F90FLAGS = -u -module objs -Iobjs -O3
LINKFLAGS = $(F90FLAGS)

#BLAS = -L/usr/local/intel/mkl/cur/lib/32 -lmkl -lguide -lpthread -lm
BLAS = -lblas
LAPACK_INCLUDE = -I/home/mjarvis/LAPACK95/lapack95_modules
LAPACK = -L/home/mjarvis/LAPACK95 -llapack95 -llapack $(BLAS)

#DEF = -DCOMPILER_WORKS

objs/%.o: %.f90
	$(F90C) $(F90FLAGS) $(DEF) -c -o $@ $<

objs/%.o: %.F90
	$(F90C) $(F90FLAGS) $(DEF) -c -o $@ $<

objs/%.o: %.f
	$(F90C) $(F90FLAGS) $(DEF) -c -o $@ $<

objs/%.o: base/%.f90
	$(F90C) $(F90FLAGS) $(DEF) -c -o $@ $<

objs/%.o: base/%.F90
	$(F90C) $(F90FLAGS) $(DEF) -c -o $@ $<

.depend: $(SRCS)
	$(MAKEDEP) -b=$(obj_dir) $(SRCS) > .depend

.PHONY: clean-all
clean-all:
	cd baryons; make -o .depend clean
	cd PS; make -o .depend clean
	cd gPS; make -o .depend clean
	cd substructure_paper; make -o .depend clean
	cd P_kappa; make -o .depend clean
	cd trispectrum; make -o .depend clean
	cd chi2; make -o .depend clean
	cd bispectrum; make -o .depend clean
	cd B_kappa; make -o .depend clean
	cd contour; make -o .depend clean
	cd lanl/density; make -o .depend clean
	cd lanl/kappa; make -o .depend clean
	cd analytic; make -o .depend clean
	cd chi; make -o .depend clean
	cd baryons; make -o .depend clean
	cd tests; make -o .depend clean
	cd diffEq; make -o .depend clean
	cd NR_comparison; make -o .depend clean
	cd Mike; make -o .depend clean

.PHONY: distclean-all
distclean-all:
	cd base; make distclean-base
	cd baryons; make -o .depend distclean
	cd PS; make -o .depend distclean
	cd gPS; make -o .depend distclean
	cd base; make -o .depend distclean-base
	cd substructure_paper; make -o .depend distclean
	cd P_kappa; make -o .depend distclean
	cd trispectrum; make -o .depend distclean
	cd chi2; make -o .depend distclean
	cd bispectrum; make -o .depend distclean
	cd B_kappa; make -o .depend distclean
	cd contour; make -o .depend distclean
	cd lanl/density; make -o .depend distclean
	cd lanl/kappa; make -o .depend distclean
	cd analytic; make -o .depend distclean
	cd chi; make -o .depend distclean
	cd baryons; make -o .depend distclean
	cd tests; make -o .depend distclean
	cd diffEq; make -o .depend distclean
	cd NR_comparison; make -o .depend distclean
	cd Mike; make -o .depend distclean
	rm -f *~
